package com.whale.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 预约明细
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReserveDetail implements Serializable {

    private String id;

    //预约的场地号
    private Integer venueNumber;

    //开始时间
    @JsonFormat(shape =  JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime beginTime;

    //结束时间
    @JsonFormat(shape =  JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    private  LocalDateTime endTime;

    //预约id
    private Long reserveId;

    //预约类型
    private Integer type;



    @Override
    public boolean equals(Object object) {
        if (this == object) // 检查是否为同一对象
            return true;
        if (object == null || getClass() != object.getClass()) // 检查类型
            return false;
        ReserveDetail other = (ReserveDetail) object; // 类型转换
        // 比较各个字段是否相等
        return venueNumber == other.venueNumber &&
                Objects.equals(beginTime, other.beginTime) &&
                Objects.equals(endTime, other.endTime) &&
                type == other.type;
    }




}
